<?php

namespace addons\git;

use app\common\library\Menu;
use think\Addons;

/**
 * 插件
 */
class Git extends Addons
{

    /**
     * 插件安装方法
     * @return bool
     */
    public function install()
    {
        $menu = [
            [
                'name'    => 'dev/git',
                'title'   => 'git管理',
                'ismenu'  => 1,
                'icon'    => 'fa fa-git',
                'sublist' => [
                    ['name' => 'dev/git/index', 'title' => '查看'],
                    ['name' => 'dev/git/recyclebin', 'title' => '回收站'],
                    ['name' => 'dev/git/add', 'title' => '添加'],
                    ['name' => 'dev/git/edit', 'title' => '编辑'],
                    ['name' => 'dev/git/del', 'title' => '删除'],
                    ['name' => 'dev/git/destroy', 'title' => '真实删除'],
                    ['name' => 'dev/git/restore', 'title' => '还原'],
                    ['name' => 'dev/git/multi', 'title' => '批量更新']
                ],
            ]
        ];
        Menu::create($menu, 'dev');
        return true;
    }

    /**
     * 插件卸载方法
     * @return bool
     */
    public function uninstall()
    {
        Menu::delete('dev/git');
        return true;
    }

    /**
     * 插件启用方法
     * @return bool
     */
    public function enable()
    {
        Menu::enable('dev/git');
        return true;
    }

    /**
     * 插件禁用方法
     * @return bool
     */
    public function disable()
    {
        Menu::disable('dev/git');
        return true;
    }

}
